--- /dev/null
+#ifndef __HVMLOADER_E820_H__
+#define __HVMLOADER_E820_H__
+
+#include <xen/hvm/e820.h>
+
+/*
+ * PC BIOS standard E820 types and structure.
+ */
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3
+#define E820_NVS 4
+
+struct e820entry {
+ uint64_t addr;
+ uint64_t size;
+ uint32_t type;
+} __attribute__((packed));
+
+#define HVM_E820_NR ((unsigned char *)HVM_E820_PAGE + HVM_E820_NR_OFFSET)
+#define HVM_E820 ((struct e820entry *)(HVM_E820_PAGE + HVM_E820_OFFSET))
+
+#endif /* __HVMLOADER_E820_H__ */
#include "config.h"
#include "apic_regs.h"
#include "pci_regs.h"
+#include "e820.h"
#include <xen/version.h>
#include <xen/hvm/params.h>
/* Replace possibly erroneous memory-size CMOS fields with correct values. */
static void cmos_write_memory_size(void)
{
- struct e820entry *map = E820_MAP;
- int i, nr = *E820_MAP_NR;
+ struct e820entry *map = HVM_E820;
+ int i, nr = *HVM_E820_NR;
uint32_t base_mem = 640, ext_mem = 0, alt_mem = 0;
for ( i = 0; i < nr; i++ )
#include "smbios_types.h"
#include "util.h"
#include "hypercall.h"
+#include "e820.h"
static int
write_smbios_tables(void *start,
static uint64_t
get_memsize(void)
{
- struct e820entry *map = E820_MAP;
- uint8_t num_entries = *E820_MAP_NR;
+ struct e820entry *map = HVM_E820;
+ uint8_t num_entries = *HVM_E820_NR;
uint64_t memsize = 0;
int i;
#include "util.h"
#include "config.h"
+#include "e820.h"
#include <stdint.h>
#include <xenctrl.h>
#include <xen/hvm/hvm_info_table.h>
static void e820_collapse(void)
{
int i = 0;
- struct e820entry *ent = (struct e820entry *)E820_MAP;
+ struct e820entry *ent = (struct e820entry *)HVM_E820;
- while ( i < (*E820_MAP_NR-1) )
+ while ( i < (*HVM_E820_NR-1) )
{
if ( (ent[i].type == ent[i+1].type) &&
((ent[i].addr + ent[i].size) == ent[i+1].addr) )
{
ent[i].size += ent[i+1].size;
- memcpy(&ent[i+1], &ent[i+2], (*E820_MAP_NR-i-2) * sizeof(*ent));
- (*E820_MAP_NR)--;
+ memcpy(&ent[i+1], &ent[i+2], (*HVM_E820_NR-i-2) * sizeof(*ent));
+ (*HVM_E820_NR)--;
}
else
{
{
uint32_t addr;
int i;
- struct e820entry *ent = (struct e820entry *)E820_MAP;
+ struct e820entry *ent = (struct e820entry *)HVM_E820;
/* Align allocation request to a reasonable boundary (1kB). */
size = (size + 1023) & ~1023;
- for ( i = *E820_MAP_NR - 1; i >= 0; i-- )
+ for ( i = *HVM_E820_NR - 1; i >= 0; i-- )
{
addr = ent[i].addr;
if ( (ent[i].type != E820_RAM) || /* not ram? */
if ( ent[i].size != size )
{
- memmove(&ent[i+1], &ent[i], (*E820_MAP_NR-i) * sizeof(*ent));
- (*E820_MAP_NR)++;
+ memmove(&ent[i+1], &ent[i], (*HVM_E820_NR-i) * sizeof(*ent));
+ (*HVM_E820_NR)++;
ent[i].size -= size;
addr += ent[i].size;
i++;
/* Reserve a RAM region in the e820 table. */
uint32_t e820_malloc(uint32_t size);
-/* General e820 access. */
-#include <xen/hvm/e820.h>
-#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
-#define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
-
/* Prepare the 32bit BIOS */
void highbios_setup(void);
e820map[6].addr = memory_size;
e820map[7].addr += memory_size;
- *E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
- memcpy(E820_MAP, e820map, sizeof(e820map));
+ *HVM_E820_NR = sizeof(e820map)/sizeof(e820map[0]);
+ memcpy(HVM_E820, e820map, sizeof(e820map));
#endif
printf("Memory size %ld MB\n", memory_size >> 20);
printf("E820 map:\n");
- print_e820_map(E820_MAP, *E820_MAP_NR);
+ print_e820_map(HVM_E820, *HVM_E820_NR);
printf("\n");
}
#include <stdarg.h>
#include <vm86.h>
-#include <xen/hvm/e820.h>
-#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
-#define E820_MAP ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
-
#define offsetof(type, member) ((unsigned) &((type *)0)->member)
struct vmx_assist_context;
+#include "../hvmloader/e820.h"
+
extern void cpuid_addr_value(uint64_t addr, uint64_t *value);
extern void hexdump(unsigned char *, int);
extern void dump_regs(struct regs *);
#include <unistd.h>
#include <inttypes.h>
-#include <xen/hvm/e820.h>
-
#include "cpu.h"
#include "exec-all.h"
#include "vl.h"
#include <sys/stat.h>
#include "xenctrl.h"
#include "xs.h"
-#include <xen/hvm/e820.h>
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#include <xen/foreign/x86_32.h>
#include <xen/foreign/x86_64.h>
#include <xen/hvm/hvm_info_table.h>
-#include <xen/hvm/e820.h>
#include <xen/io/protocols.h>
#include "xg_private.h"
}
#if defined(__i386__) || defined(__x86_64__)
-#include <xen/hvm/e820.h>
+#include "xc_e820.h"
int xc_domain_set_memmap_limit(int xc_handle,
uint32_t domid,
unsigned long map_limitkb)
#include "xg_save_restore.h"
#include <xen/hvm/params.h>
-#include <xen/hvm/e820.h>
+#include "xc_e820.h"
/*
** Default values for important tuning parameters. Can override by passing
--- /dev/null
+#ifndef __XC_E820_H__
+#define __XC_E820_H__
+
+#include <xen/hvm/e820.h>
+
+/*
+ * PC BIOS standard E820 types and structure.
+ */
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3
+#define E820_NVS 4
+
+struct e820entry {
+ uint64_t addr;
+ uint64_t size;
+ uint32_t type;
+} __attribute__((packed));
+
+#endif /* __XC_E820_H__ */
#include <xen/foreign/x86_64.h>
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/params.h>
-#include <xen/hvm/e820.h>
+#include "xc_e820.h"
#include <xen/libelf.h>
static void build_e820map(void *e820_page, unsigned long long mem_size)
{
struct e820entry *e820entry =
- (struct e820entry *)(((unsigned char *)e820_page) + E820_MAP_OFFSET);
+ (struct e820entry *)(((unsigned char *)e820_page) + HVM_E820_OFFSET);
unsigned long long extra_mem_size = 0;
unsigned char nr_map = 0;
nr_map++;
}
- *(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
+ *(((unsigned char *)e820_page) + HVM_E820_NR_OFFSET) = nr_map;
}
static int loadelfimage(
if ( (e820_page = xc_map_foreign_range(
xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
- E820_MAP_PAGE >> PAGE_SHIFT)) == NULL )
+ HVM_E820_PAGE >> PAGE_SHIFT)) == NULL )
goto error_out;
memset(e820_page, 0, PAGE_SIZE);
build_e820map(e820_page, v_end);
#include <asm/hvm/hvm.h>
#include <asm/hvm/support.h>
#include <asm/processor.h>
-#include <public/hvm/e820.h>
long arch_do_domctl(
struct xen_domctl *domctl,
#ifndef __E820_HEADER
#define __E820_HEADER
-#include <public/hvm/e820.h>
+/*
+ * PC BIOS standard E820 types and structure.
+ */
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3
+#define E820_NVS 4
+
+struct e820entry {
+ uint64_t addr;
+ uint64_t size;
+ uint32_t type;
+} __attribute__((packed));
#define E820MAX 128
#ifndef __XEN_PUBLIC_HVM_E820_H__
#define __XEN_PUBLIC_HVM_E820_H__
-/* PC BIOS standard E820 types. */
-#define E820_RAM 1
-#define E820_RESERVED 2
-#define E820_ACPI 3
-#define E820_NVS 4
-
/* E820 location in HVM virtual address space. */
-#define E820_MAP_PAGE 0x00090000
-#define E820_MAP_NR_OFFSET 0x000001E8
-#define E820_MAP_OFFSET 0x000002D0
-
-struct e820entry {
- uint64_t addr;
- uint64_t size;
- uint32_t type;
-} __attribute__((packed));
+#define HVM_E820_PAGE 0x00090000
+#define HVM_E820_NR_OFFSET 0x000001E8
+#define HVM_E820_OFFSET 0x000002D0
#define HVM_BELOW_4G_RAM_END 0xF0000000
-
#define HVM_BELOW_4G_MMIO_START HVM_BELOW_4G_RAM_END
#define HVM_BELOW_4G_MMIO_LENGTH ((1ULL << 32) - HVM_BELOW_4G_MMIO_START)